package com.ttg.common.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

@Getter
public enum ConditionsClassEnum {

    BANK_CUSTOMER_INFO(1,"客户基本信息","tbl_app_coupon_vip"),
    BANK_CARD_DATA_INFO(3,"银行卡信息","tbl_bank_card_data_info"),
    BANK_PRODUCT_DATA_INFO(4,"业务类","tbl_bank_product_data_info"),
    BANK_CUSTOMER_SIGN_INFO(5,"客户签约","tbl_bank_customer_sign_info"),
    BANK_CARD_BINDING_INFO(6,"卡签约信息","tbl_bank_card_binding_info"),

    QYYX_CUST_AUM(9,"个人客户AUM","tbl_qyyx_cust_aum"),
    QYYX_CUST_GROUP(10,"个人客户客群","tbl_qyyx_cust_group"),
    QYYX_CUST_SIGN_TAG(11,"个人客户标签","tbl_qyyx_cust_sign_tag"),
    QYYX_DEPOSIT_ACCOUNT_DETAIL(12,"个人客户存款账户","tbl_qyyx_deposit_account_detail"),
    QYYX_DEPOSIT_AMOUNT(13,"个人客户存款","tbl_qyyx_deposit_amount"),

    BANK_PRIVATE_PRIMITIVE01(201,"客户AUM（资产管理）AUM","tbl_bank_private_primitive_01"),
    BANK_PRIVATE_PRIMITIVE02(202,"客户AUM（资产管理）存款","tbl_bank_private_primitive_02"),
    BANK_PRIVATE_PRIMITIVE03(203,"客户AUM（资产管理）财富","tbl_bank_private_primitive_03"),
    BANK_PRIVATE_PRIMITIVE04(204,"客户AUM（资产管理）定期存款","tbl_bank_private_primitive_04"),
    BANK_PRIVATE_PRIMITIVE05(205,"客户AUM（资产管理）活期存款","tbl_bank_private_primitive_05"),
    BANK_PRIVATE_PRIMITIVE06(206,"客户AUM（资产管理）活期存款交易总笔数","tbl_bank_private_primitive_06"),
    BANK_PRIVATE_PRIMITIVE07(207,"客户AUM（资产管理）财富交易总笔数","tbl_bank_private_primitive_07"),
    BANK_PRIVATE_PRIMITIVE08(208,"客户AUM（资产管理）自营理财","tbl_bank_private_primitive_08"),
    BANK_PRIVATE_PRIMITIVE09(209,"客户AUM（资产管理）代销理财","tbl_bank_private_primitive_09"),
    BANK_PRIVATE_PRIMITIVE10(210,"客户AUM（资产管理）代销基金","tbl_bank_private_primitive_10"),
    BANK_PRIVATE_PRIMITIVE11(211,"客户AUM（资产管理）代销保险","tbl_bank_private_primitive_11"),
    BANK_PRIVATE_PRIMITIVE12(212,"客户AUM（资产管理）代销贵金属","tbl_bank_private_primitive_12"),
    BANK_PRIVATE_PRIMITIVE13(213,"客户AUM（资产管理）网联转入交易笔","tbl_bank_private_primitive_13"),
    BANK_PRIVATE_PRIMITIVE14(214,"客户AUM（资产管理）网联转入交易金额","tbl_bank_private_primitive_14"),
    BANK_PRIVATE_PRIMITIVE15(215,"客户AUM（资产管理）网联转出交易笔数","tbl_bank_private_primitive_15"),
    BANK_PRIVATE_PRIMITIVE16(216,"客户AUM（资产管理）网联转出交易金额","tbl_bank_private_primitive_16"),

    BANK_PUBLIC_PRIMITIVE(7,"商户基本信息","tbl_bank_public_primitive"),
    BANK_PUBLIC_TRADE_PRIMITIVE_101(8101,"商户信息-交易金额","tbl_bank_public_trade_primitive_101"),
    BANK_PUBLIC_TRADE_PRIMITIVE_201(8201,"商户信息-手续费金额","tbl_bank_public_trade_primitive_201"),
    BANK_PUBLIC_TRADE_PRIMITIVE_301(8301,"商户信息-补贴金额","tbl_bank_public_trade_primitive_301"),
    BANK_PUBLIC_TRADE_PRIMITIVE_102(8102,"商户信息-交易笔数","tbl_bank_public_trade_primitive_102"),
    BANK_PUBLIC_TRADE_PRIMITIVE_103(8103,"商户信息-交易天数","tbl_bank_public_trade_primitive_103"),

    BANK_PUBLIC_INDUSTRY(9999,"自定义-商户所属行业-子查询","");

    private final int value;
    private final String desc;
    private final String tableName;
    /**
     * AUM相关枚举value集合
     */
    private static final List<Integer> BANK_PRIVATE_PRIMITIVE_VALUES = new ArrayList<>();
    private static final List<Integer> BANK_PUBLIC_TRADE_PRIMITIVE_VALUES = new ArrayList<>();

    ConditionsClassEnum(int value, String desc,String tableName) {
        this.value = value;
        this.desc = desc;
        this.tableName = tableName;
    }

    public static ConditionsClassEnum getByValue(Integer value){
        for (ConditionsClassEnum conditionsClassEnum : values()) {
            if (conditionsClassEnum.getValue()==value){
                return conditionsClassEnum;
            }
        }
        return null;
    }


    public static String getTableNameByValue (Integer value){
        for (ConditionsClassEnum conditionsClassEnum : values()) {
            if (conditionsClassEnum.getValue()==value){
                return conditionsClassEnum.getTableName();
            }
        }
        return null;
    }

    public static boolean needSumByAgent (Integer value){
        return BANK_PRIVATE_PRIMITIVE_VALUES.contains(value);
    }

    public static List<Integer> getBankPrivatePrimitiveValues (){
        return BANK_PRIVATE_PRIMITIVE_VALUES;
    }

    static {
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE01.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE02.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE03.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE04.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE05.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE06.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE07.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE08.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE09.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE10.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE11.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE12.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE13.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE14.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE15.getValue());
        ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES.add(BANK_PRIVATE_PRIMITIVE16.getValue());
    }


    static {
        ConditionsClassEnum.BANK_PUBLIC_TRADE_PRIMITIVE_VALUES.add(BANK_PUBLIC_TRADE_PRIMITIVE_101.getValue());
        ConditionsClassEnum.BANK_PUBLIC_TRADE_PRIMITIVE_VALUES.add(BANK_PUBLIC_TRADE_PRIMITIVE_201.getValue());
        ConditionsClassEnum.BANK_PUBLIC_TRADE_PRIMITIVE_VALUES.add(BANK_PUBLIC_TRADE_PRIMITIVE_301.getValue());
        ConditionsClassEnum.BANK_PUBLIC_TRADE_PRIMITIVE_VALUES.add(BANK_PUBLIC_TRADE_PRIMITIVE_102.getValue());
        ConditionsClassEnum.BANK_PUBLIC_TRADE_PRIMITIVE_VALUES.add(BANK_PUBLIC_TRADE_PRIMITIVE_103.getValue());

    }

    public static List<Integer> forPrivateEnums(){
        return new ArrayList<Integer>(){{
            this.add(BANK_CUSTOMER_INFO.getValue());
            this.add(BANK_CARD_DATA_INFO.getValue());
            this.add(BANK_PRODUCT_DATA_INFO.getValue());
            this.add(BANK_CUSTOMER_SIGN_INFO.getValue());
            this.add(BANK_CARD_BINDING_INFO.getValue());
            this.add(QYYX_CUST_AUM.getValue());
            this.add(QYYX_CUST_GROUP.getValue());
            this.add(QYYX_CUST_SIGN_TAG.getValue());
            this.add(QYYX_DEPOSIT_ACCOUNT_DETAIL.getValue());
            this.add(QYYX_DEPOSIT_AMOUNT.getValue());
            this.addAll(ConditionsClassEnum.BANK_PRIVATE_PRIMITIVE_VALUES);
        }};
    }



    public static List<Integer> forPublicEnums(){
        return new ArrayList<Integer>(){{
            this.add(BANK_PUBLIC_PRIMITIVE.getValue());
            this.addAll(ConditionsClassEnum.BANK_PUBLIC_TRADE_PRIMITIVE_VALUES);
        }};
    }
}
